namespace ApplicationControllerExample.Infrastructure.IoC
{
    using System.Windows.Forms;
    using Model.Commands;
    using Model.Services;
    using Views.Main;
    using Views.Secondary;
    using Core;
    using EventAggregator;
    using Model;
    using StructureMap.Configuration.DSL;

    public class DefaultRegistry : Registry
    {
        public DefaultRegistry()
        {
            ForRequestedType<ApplicationContext>()
                .TheDefault.Is.OfConcreteType<AppContext>();

            ForRequestedType<IMainView>()
                .TheDefault.Is.OfConcreteType<MainView>();

            ForRequestedType<IApplicationController>()
                .TheDefault.Is.OfConcreteType<ApplicationController>();

            ForRequestedType<MainPresenter>()
                .TheDefault.Is.OfConcreteType<MainPresenter>();

            ForRequestedType<IEventPublisher>()
                .AsSingletons()
                .TheDefault.Is.OfConcreteType<EventPublisher>();

            ForRequestedType<ICommand<SomeCommandData>>()
                .TheDefault.Is.OfConcreteType<SomeCommand>();

            ForRequestedType<ISomeWorkflowService>()
                .TheDefault.Is.OfConcreteType<SomeWorkflowService>();

            ForRequestedType<IPartOfTheProcess>()
                .TheDefault.Is.OfConcreteType<SecondaryPresenter>();

            ForRequestedType<ISecondaryView>()
                .TheDefault.Is.OfConcreteType<SecondaryView>();

            RegisterInterceptor(new EventAggregatorInterceptor());
        }
    }
}